//
//  NetRequestClass.h
//  
//
//  Created by apple开发 
//
//

#import <Foundation/Foundation.h>

@interface NetRequestClass : NSObject

// 定义返回请求数据的block类型
typedef void (^ReturnValueBlock) (id returanValue);
typedef void (^ErrorCodeBlock) (NSError *error);
#pragma 检测网络的可连接性
+ (BOOL)NetWorkReachabilityWithURLString:(NSString *)strUrl;
+ (BOOL)NetWorkReachability;

// 取消所有请求
+ (void)cancelOperations;

/**
 *  文件下载请求
 *
 *  @param requestURLString 请求URL
 *  @param complete         是否成功
 */
//+ (void)downloadFileWithRequestURL:(NSString *)requestURLString
//                          complete:(void(^)(BOOL))complete;
/**
 *  POST请求
 *
 *  @param requestURLString 请求URL
 *  @param parameter        请求参数
 *  @param returnValueBlock 成功返回块
 *  @param errorBlock       错误返回块
 */
+ (void)NetRequestPostWithRequestURL:(NSString *)requestURLString
                       WithParameter:(NSDictionary *)parameter
                WithReturnValutBlock:(ReturnValueBlock) returnValueBlock
                  WithErrorCodeBlock:(ErrorCodeBlock) errorBlock;


/**
 *  Get请求
 *
 *  @param requestURLString 链接URL
 *  @param parameter        必要参数
 *  @param returnValueBlock 成功返回块
 *  @param errorBlock       错误返回块
 */
+ (void)NetRequestGetWithRequestURL:(NSString *)requestURLString
                      WithParameter:(NSDictionary *)parameter
               WithRetuanValueBlock:(ReturnValueBlock)returnValueBlock
                 WithErrorCodeBlock:(ErrorCodeBlock)errorBlock;

@end
